﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService
Partial Class Control_MSDS_Section12View
    Inherits System.Web.UI.UserControl
#Region "EVENT FOR CONTROL"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Translate()
            Me.EnableViewState = False
            If Not Request.QueryString("Id").ToString.Equals("0") Then
                hidMSDSID.Value = Request.QueryString("Id")
            End If
            CheckData()
        End If
    End Sub


#End Region
#Region "PRIAVTE SUB AND FUNCTION"
    Protected Sub Translate()
        lblSection12Title.Text = getTranslate("lblSection12Title", Session("LanguageId"), lblSection12Title.Text)
        lbSection12Title1.Text = getTranslate("lbSection12Title1", Session("LanguageId"), lbSection12Title1.Text)
        lblSection12TenTP.Text = getTranslate("lblSection12TenTP", Session("LanguageId"), lblSection12TenTP.Text)
        lbSection12LoaiSV.Text = getTranslate("lbSection12LoaiSV", Session("LanguageId"), lbSection12LoaiSV.Text)
        lblSection12CKAH.Text = getTranslate("lblSection12CKAH", Session("LanguageId"), lblSection12CKAH.Text)
        lblSection12KQ.Text = getTranslate("lblSection12KQ", Session("LanguageId"), lblSection12KQ.Text)
        lblSection12lbTacDongMT.Text = getTranslate("lblSection12lbTacDongMT", Session("LanguageId"), lblSection12lbTacDongMT.Text)

    End Sub
    Sub CheckData()
        Using data As New VSEntities
            Dim LanguageId = Session("LanguageId").ToString()
            Dim p = (From q In data.MSDSSection12 Where q.LanguageId = LanguageId And q.MSDSId = hidMSDSID.Value).FirstOrDefault()
            If Not p Is Nothing Then
                txtS12110.Text = p.S12110
                txtS12111.Text = p.S12111
                txtS12112.Text = p.S12112
                txtS12113.Text = p.S12113

                txtS12120.Text = p.S12120
                txtS12121.Text = p.S12121
                txtS12122.Text = p.S12122
                txtS12123.Text = p.S12123

                txtS12130.Text = p.S12130
                txtS12131.Text = p.S12131
                txtS12132.Text = p.S12132
                txtS12133.Text = p.S12133

                txtS12140.Text = p.S12140
                txtS12141.Text = p.S12141
                txtS12142.Text = p.S12142
                txtS12143.Text = p.S12143
                txtS1212.Text = p.S1221
                hidID.Value = p.Section12Id
            End If
        End Using
    End Sub
#End Region
End Class
